<script setup lang="ts">
  import { computed, onMounted, ref } from 'vue'
  import Passoword from './components/passoword.vue'
  import mobil from './components/mobile.vue'

  const tabMetas = [
    { title: '密码登录', subTitle: '验证码登录' },
    { title: '验证码登录', subTitle: '密码登录' },
  ]

  const tabIndex = ref(0)
  const tabMeta = computed(() => {
    return tabMetas[tabIndex.value]
  })

//qq登录
  onMounted(() => {
    ;(window as any).QC.Login({
      btnId: 'qqLoginBtn', //插入按钮的节点id
    })
  })
</script>

<template>
  <view class="user-login">
    <view class="login-type">
      <view class="title">{{ tabMeta.title }}</view>
      <view class="type" @click="tabIndex = tabIndex ? 0 : 1">
        <text>{{ tabMeta.subTitle }}</text>
        <uni-icons color="#3c3e42" type="forward" />
      </view>
    </view>
    <!-- 中间表单 -->
    <Passoword v-if="tabIndex === 0" />
    <mobil v-else />
  </view>
  <!-- 社交账号登录 -->
  <view class="social-login">
    <view class="legend">
      <text class="text">其它方式登录</text>
    </view>
    <view class="social-account">
      <a class="icon" href="https://graph.qq.com/oauth2.0/authorize?client_id=100495085&amp;response_type=token&amp;scope=all&amp;redirect_uri=https%3A%2F%2Fmusic.163.com%2Fback%2Fqq">
        <uni-icons color="#00b0fb" size="30" type="qq" />
      </a>
      <view class="icon">
        <uni-icons color="#fb6622" size="30" type="weibo" />
      </view>
      <view class="icon">
        <uni-icons color="#07C160" size="30" type="weixin" />
      </view>
    </view>
  </view>
</template>

<style lang="scss">
  @import './login.scss';
</style>
